import Day11.d06_recommend_pb2_grpc
import Day11.d06_recommend_pb2
import grpc
import time

# 1.创建一个可以跟推荐系统通讯的通道
channel = grpc.insecure_channel('127.0.0.1:8888')

# 2.创建存根stub
stub = Day11.d06_recommend_pb2_grpc.UserRecommendStub(channel)

# 3.构建请求参数对象
req = Day11.d06_recommend_pb2.UserRequest()
req.user_id = '1'
req.channel_id=1
req.article_num =3
req.time_stamp = round(time.time()*1000)

# 4.rpc调用
response = stub.user_recommend(req)

# 5.处理结果
print(response)